import { Toast } from "./uniHooks/toast";

export const downloadFile = (v: string) =>

{
	uni.showLoading({
		title:'下载中'
	})
	
	uni.downloadFile({
	url: v,
	success: (res) => {
		if (res.statusCode === 200) {
			uni.hideLoading()
			Toast('下载成功')
			setTimeout(()=>{
				uni.openDocument({
					filePath: res.tempFilePath,
				});
			},1500)
			
		}else{
			uni.hideLoading()
			Toast('下载失败')
		}
	}
});}

